<!DOCTYPE html>
<html>

<head>
    <title>我的消息</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="/js/plugins/bootstrap-4.1.1-dist/css/bootstrap.min.css">
    <script src="/js/plugins/jquery/jquery.min.js"></script>
    <script src="/js/plugins/bootstrap-4.1.1-dist/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="/css/font/css/font-awesome.min.css" />
    <link rel="stylesheet" href="/css/reset.css" />
    <link rel="stylesheet" href="/css/message.css" />
    <link rel="stylesheet" href="/css/strategy.css" />
    <link rel="stylesheet" href="/css/strategyCatalogs.css"/>
    <script src="/js/plugins/jrender/jrender.min.js"></script>
    <script src="/js/common.js"></script>
    <style>
        .date{
            color: #BBBBBB;
            margin-left: 0px;
            font-size: 11px;
        }
    </style>
    <script>
        $(function () {
            var user = JSON.parse(sessionStorage.getItem('user'));
            var params = getParams();
            //根据用户id来获取自己的游记评论
            $.get("/users/"+user.id+"/travelComments",function (data) {
                $('#comment').renderValues(data, {
                    getImgs:function (item, value) {
                        var imgs = value.split(';');
                        console.log(imgs);
                        var temp = '';
                        for (var i = 0; i < imgs.length - 1; i++) {
                            temp += '<li><img src=' + imgs[i] + '></li>';
                        }
                        $(item).html(temp);
                    },
                    getHref:function (item, value) {
                        var href = $(item).data('href');
                        $(item).attr('href',href+value);
                    }
                });
                //跳转至游记详情
                $('.comment-right').click(function () {
                    var travelId = $(this).attr('travelId');
                    console.log(travelId);
                    location.href="/travelContent.html?id="+travelId;
                });
            });
        })
    </script>
    <style>
        .template{
            background-color: #f0f0f0;
            height: 8px;
        }
    </style>
</head>

<body>
<div class="search-head">
    <div class="row nav-search">
        <div class="col">
            <a href="javascript:history.go(-1);">
                <span><i class="fa fa-chevron-left"></i></span>
            </a>
        </div>
        <div class="col">
            <span style="font-size: 20px">我的评论</span>
        </div>
        <div class="col"></div>
    </div>
</div>
<div id="comment">
    <div render-loop="result">
        <div class="container row comment">
            <div class="col-2 comment-head">
                <a data-href="/userProfiles.html?id=" render-key="result.user.id" render-fun="getHref">
                    <img class="rounded-circle"
                         render-src="result.user.headImgUrl">
                </a>
            </div>
            <div class="col comment-right" render-attr="travelId=result.travel_id">

                <p class="authorName"><span render-html="result.user.nickName"></span></p>
                <span class="date" render-html="result.createTime"></span>
                </span>
                <div class="comment-content">
                    <a href="#">
                        <p render-html="result.content"></p>
                    </a>
                </div>

                <ul class="comment-img" render-key="result.imgUrls" render-fun="getImgs">
                    <li>

                    </li>
                </ul>
                <hr/>
            </div>
        </div>
    </div>
</div>
</body>
</html>